package cn.edu.djtu.fw.action;

import java.util.Map;

import org.apache.struts2.interceptor.ApplicationAware;
import org.springframework.beans.factory.annotation.Autowired;

import cn.edu.djtu.fw.model.Json;
import cn.edu.djtu.fw.service.SystemServiceI;
import cn.edu.djtu.fw.util.JsonUtil;

import com.opensymphony.xwork2.ActionSupport;

public class SystemAction extends ActionSupport implements ApplicationAware {
	private static final long serialVersionUID = 1L;
	private Map<String, Object> application;
	private SystemServiceI systemService;

	@Override
	public void setApplication(Map<String, Object> application) {
		this.application = application;
	}

	public String refreshSystem() throws Exception {
		systemService.refreshApplication(application);
		Json j = new Json();
		j.setSuccess(true);
		j.setMsg("操作成功");
		JsonUtil.writeJson(j);
		return null;
	}

	public SystemServiceI getSystemService() {
		return systemService;
	}

	@Autowired
	public void setSystemService(SystemServiceI systemService) {
		this.systemService = systemService;
	}
}